package cn.com.jslh.boarpro.main.model;

import android.content.Context;

import com.blankj.utilcode.util.SPUtils;

import java.util.List;

import cn.com.jslh.boarpro.base.BaseApplication;
import cn.com.jslh.boarpro.base.mvp.BaseListModel;
import cn.com.jslh.boarpro.tables.ModelTable;
import cn.com.jslh.boarpro.util.WebService;
import cn.com.jslh.boarpro.util.database.DataBaseUtil;

/**
 * 作者：周洲 on 2017/7/12 16:10
 * <p>
 * 邮箱：double0zhou@126.com
 */

public class MainModelImpl extends BaseListModel {

    public MainModelImpl(Context context) {
        super(context);
    }

    /**
     * 主页模块展示
     * @param params
     * @return
     */
    @Override
    public List<?> getDatas(String... params) {
        return DataBaseUtil.GetData(context, ModelTable.class);
    }

    public void loginOut(WebService.NetSuccessListener netSuccessListener){
        new WebService.Builder(context, "logout", "EASLogin") //exportGongZhuData //分娩母猪
                .addProperty("userName", SPUtils.getInstance().getString(BaseApplication.FUSERNAME))
                .addProperty("slnName", "eas")
                .addProperty("dcName", "LiHua")
                .addProperty("language", "L")
                .success(netSuccessListener)
                .post();
    }
}
